package com.ccc.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.ccc.dao.DestributeDao;
import com.ccc.model.Destribute;

@Component("destributeService")
@Transactional
public class DestributeService {
	@Resource
	private DestributeDao destributeDao;
	
	public void add(Destribute destribute){
		this.destributeDao.addDestribute(destribute);
	}
	
	public void update(Destribute destribute){
		this.destributeDao.updateDestribute(destribute);
	}
	
	public Destribute find(){
		List<Destribute> list = this.destributeDao.findFirst();
		if(list != null && list.size()>0){
			return list.get(0);
		}else{
			return null;
		}
	}
}
